<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <cpn1></cpn1>
  <cpn2></cpn2>
</div>

<script src="../js/vue.js"></script>
<script>
  // 1. 注册全局组件的语法糖
  Vue.component('cpn1', {
    template: `
      <div>
        <h2>我是标题1</h2>
        <div>我是内容1</div>
      </div>
    `
  });

  const app = new Vue({
    el: '#app',
    data: {
      message: '你好'
    },
    // 2. 注册局部组件的语法糖
    components: {
      cpn2: {
        template: `
          <div>
            <h2>我是标题2</h2>
            <div>我是内容2</div>
          </div>`
      }
    }
  });
</script>
</body>
</html>